package com.koron.ticket.work.workline.controller;


import com.koron.bean.base.Response;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.ticket.work.workline.bean.WorkLine;
import com.koron.ticket.work.workline.service.WorkLineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (TicketWorkLine)表控制层
 *
 * @author 朱超
 * @since 2021-11-11 17:19:02
 */
@Api(tags = "TicketWorkLine接口")
@RestController
@RequestMapping("ticketWorkLine")
public class WorkLineController {
    
    @Autowired
    private WorkLineService workLineService;

    private String getCurrDs() {
        return ThreadLocalContext.get().getCurrDs();
    }
    
    /**
     * 新增单条数据
     *
     * @param 
     * @return Response
     * @see Response
     * @version 1.0
     */
    @PostMapping("insert")
    @ApiOperation(value = "新增单条数据")
    public Response insert(@RequestBody WorkLine workLine) {
        return ADOConnection.runTask(getCurrDs(), workLineService, "insert", Response.class, workLine);
    }
    
    /**
     * 根据id删除单条数据
     *
     * @param id 主键
     * @return Response对象
     * @see Response
     * @version 1.0
     */
    @DeleteMapping("deleteById")
    @ApiOperation(value = "根据id删除单条数据")
    public Response deleteById(@RequestParam("id") String id) {
        return ADOConnection.runTask(getCurrDs(), workLineService, "deleteById", Response.class, id);
    }
    
    /**
     * 修改数据
     *
     * @param workLine
     * @return Response
     * @see Response
     * @version 1.0
     */
    @PutMapping("update")
    @ApiOperation(value = "修改单条配置详情")
    public Response update(@RequestBody WorkLine workLine) {
        return ADOConnection.runTask(getCurrDs(), workLineService, "update", Response.class, workLine);
    }

    /**
     * 通过id查询单条数据
     *
     * @param id 主键
     * @return Response
     * @see Response
     * @version 1.0
     */
    @ApiOperation(value = "根据id查询")
    @GetMapping("getById")
    public Response getById(@RequestParam("id") String id) {
        return ADOConnection.runTask(getCurrDs(), workLineService, "getById", Response.class, id);
    }

}
